export function dateFormat(time: string | number) {
  let formatTime;
  let date;
  if (time === 0) {
    date = new Date();
  } else {
    date = new Date(time);
  }
  let Year = date.getFullYear();
  let month = date.getMonth() + 1;
  let Month = month >= 10 ? month : "0" + month;
  let day = date.getDate();
  let Day = day >= 10 ? day : "0" + day;
  let Hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  let Minute =
    date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  let Second =
    date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  if (time) {
    formatTime =
      Year + "-" + month + "-" + day + " " + Hour + ":" + Minute + ":" + Second;
    return formatTime;
  }
}

export function moneyFormat(money: number) {
  return "¥" + money;
}
